<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>13-v-model在CheckBox中的使用</title>
</head>
<body>
    <div id="app">
       <div>
            <!-- 单个复选框时,v-model绑定一个bool值 -->
            <label for="agreement">
                <input type="checkbox" name="agreement" id="agreement" v-model="agreement">
                同意协议
            </label>
            <button :disabled="!agreement">下一步</button>
       </div>

       <div>
           <!-- 多个复选框为一组时,v-model绑定一个数组 -->
           <label for="basketball">
               <input type="checkbox" name="hobby" id="basketball" v-model="hobbies" value="篮球">
            篮球
           </label>
            <label for="football">
                <input type="checkbox" name="hobby" id="football" v-model="hobbies" value="足球">
            足球
            </label>
            <label for="badminton">
                <input type="checkbox" name="hobby" id="badminton" v-model="hobbies" value="羽毛球">
            羽毛球
            </label>

            <h1>{{hobbies}}</h1>
       </div>
    </div>
    <script src="./js/vue.js"></script>
    <script>
        const app = new Vue({
            el: "#app",
            data: {
                agreement: true,
                hobbies:[]
            }
        })
    </script>
</body>
</html>